<div class="layui-container">
    <div class="layui-row">
        <div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
			<div class="widget-head">
				<div class="widget-title">店铺列表</div>
			</div>
			<div class="layui-col-md12 layui-col-xs12 widget-body ">	
				<div class="layui-form-item">
					<form class="layui-form" method="post" action="">
						<input type="hidden" name="s" value="/{$request->pathinfo()}">
						<div class="layui-col-sm12 layui-col-md12">
							<div class="layui">
								<div class="layui-col-md3">
									<label class="layui-form-label">店铺名称：</label>
									<div class="layui-col-md6 ">
										<input type="text" class="layui-input" name="name" placeholder="请输入店铺名称" value="{$request->post('name')}">
									</div>
								</div>
								<div class="layui-col-md4 layui-col-flex">
									<label class="layui-form-label">状态：</label>
									<span style="display:none;">{$is_delete = $request->post('is_delete') ?: null}</span>
									<select class="form-control" name="is_delete" data-layer-selected="{searchBox: 1, btnSize: 'sm',  placeholder: '状态', maxHeight: 400}">
											<option value="" selected="selected">全部</option>
											<option value="1" {$request->post('is_delete')==1 ?'selected="selected"':'';}>未审核</option>
											<option value="2" {$request->post('is_delete')==2 ?'selected="selected"':'';}>审核通过</option>
											<option value="3" {$request->post('is_delete')==3 ?'selected="selected"':'';}>审核不通过</option>
											<option value="4" {$request->post('is_delete')==4 ?'selected="selected"':'';}>已删除</option>
											<option value="5" {$request->post('is_delete')==5 ?'selected="selected"':'';}>休息中</option>

									</select>
								</div>
								<div class="layui-col-md2">
									<button class="layui-btn" lay-submit lay-filter="formDemo">搜索</button>
								</div>
								<div class="layui-col-md1">
									<a class="layui-btn"  href="{:url('merchant/renovationedit')}"> <i class="mdi menu-icon mdi-plus"></i>新增</a>
								</div>
							</div>
						</div>
					</form>
				</div>

				<div class="layui-col-md12" >
					<table width="100%" class="layui-table">
						<thead>
						<tr>
							<th>店铺ID</th>
							<th width="20%">logo</th>
							<th>店铺名称</th>
							<th>负责人姓名</th>
							<th>店铺地址</th>
							<th>联系电话</th>
							<th>店铺介绍</th>
							<th>添加时间</th>
							<th>店铺状态</th>
							<th>操作</th>
						</tr>
						</thead>
						<tbody>
						{if !$list->isEmpty()}{foreach $list as $item}
							<tr>
								<td>{$item['merchant_id']}</td>
								<td>
									<a href="/uploads/{$item['logo']}.png" title="点击查看大图" target="_blank">
										<img src="/uploads/{$item['logo']}.png" alt="">
									</a>
								</td>
								<td>
									 <p class="item-title">{$item['merchant_name']}</p>
								</td>
								<td>{$item['merchant_set']}</td>
								<td>{$item['provincename'].$item['cityname'].$item['districtname'].$item['address']}</td>
								<td>{$item['phone']}</td>
								<td>{$item['jieshao']}</td>
								<td>{$item['create_time']}</td>
								<td>{$delete_type[$item['is_delete']]}</td>


								<td>
									<div class="tpl-table-black-operation">

										<a href="{:url('merchant/renovationedit',
											['merchant_id' => $item['merchant_id'],'type' => 'shoudetail'])}">
											<i class="mdi menu-icon mdi-pencil"></i> 详情
										</a>
										{if ($item['is_delete'] === 2)}
										<a href="javascript:;" class="item-deletead tpl-table-black-operation-del"
										   data-id="{$item['merchant_id']}">
											<i class="mdi menu-icon mdi-delete-forever"></i> 下架
										</a>
										{/if}
										{if ($item['is_delete'] === 4)}
										<a href="javascript:;" class="item-deletecd tpl-table-black-operation-del"
										   data-id="{$item['merchant_id']}">
											<i class="mdi menu-icon mdi-delete-forever"></i> 上架
										</a>
										{/if}
										{if ($item['is_delete'] === 1)}
										<a href="javascript:;" class="merchant-uptatead tpl-table-black-operation-del"
										   data-id="{$item['merchant_id']}">
											<i class="mdi menu-icon mdi-pencil"></i> 审核通过
										</a>
										<a href="javascript:;" class="merchant-uptatecd tpl-table-black-operation-del"
										   data-id="{$item['merchant_id']}">
											<i class="mdi menu-icon mdi-delete-forever"></i> 审核不通过
										</a>
										{/if}
									</div>
								</td>
							</tr>
							{/foreach}{else/}
							<tr>
								<td colspan="12" class="layer-text-center">暂无记录</td>
							</tr>
						{/if}
						</tbody>
					</table>
				</div>
				<div class="layui-col-lg12">
					<div class="layui-fr">{$list|raw}</div>
					<div class="layui-fr pagination-total layer-margin-right">
						<div class="layer-vertical-align-middle">总记录：{$list->total()}</div>
					</div>
				</div>
			</div>
        </div>
    </div>
</div>
<script>
    $(function () {

        // 下架
        $('.item-deletead').deletead('id', "{:url('merchant/uptatead')}",'','deletead');
        // 上架
        $('.item-deletecd').deletead('id', "{:url('merchant/uptatead')}",'','deletecd');

        // 审核通过
        $('.merchant-uptatead').updatead('id', "{:url('merchant/uptatead')}",'','uptatead');
        // 审核不通过
        $('.merchant-uptatecd').updatecd('id', "{:url('merchant/uptatead')}",'','uptatecd');
    });
	 
</script>

